Skip to contentSkip to conversation

Drivers are doing useless check for pthread_mutex_init return value

DPDK/ethdev Bug 1586 [email protected] 1 participant 2 messages Nov 20, 2024 – Mar 26, 2025

lore
Share & tools
lore
#0 lore raw

https://bugs.dpdk.org/show_bug.cgi?id=1586

            Bug ID: 1586
           Summary: Drivers are doing useless check for pthread_mutex_init
                    return value
           Product: DPDK
           Version: 24.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: minor
          Priority: Normal
         Component: ethdev
          Assignee: [email protected]
          Reporter: [email protected]

Target Milestone: ---

Various checkers will warn that checking the return value of pthread_mutex_init() will always be zero.

The documentation states:

RETURN VALUE
pthread_mutex_init always returns 0. The other mutex functions return 0 on success and a non-zero error code on error.

Very minor issue, since it only results in bogus warnings and few instructions of extra code in the startup path.

drivers/common/cnxk/roc_bphy_cgx.c: ret =
pthread_mutex_init(&roc_cgx->lock, NULL); drivers/net/bnxt/bnxt_ethdev.c: err = pthread_mutex_init(&bp->flow_lock, NULL); drivers/net/bnxt/bnxt_ethdev.c: err = pthread_mutex_init(&bp->def_cp_lock, NULL);
drivers/net/bnxt/bnxt_ethdev.c: err = pthread_mutex_init(&bp->health_check_lock, NULL); drivers/net/bnxt/bnxt_ethdev.c: err = pthread_mutex_init(&bp->err_recovery_lock, NULL); drivers/net/bnxt/bnxt_ethdev.c: rc = pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL);
drivers/net/bnxt/bnxt_txq.c: rc = pthread_mutex_init(&txq->txq_lock, NULL);
drivers/net/bnxt/tf_ulp/bnxt_ulp.c: rc =
pthread_mutex_init(&session->bnxt_ulp_mutex, NULL); drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c: rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c: rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL);
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c: rc =
pthread_mutex_init(&ulp_fc_info->fc_lock, NULL);
drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c: rc =
pthread_mutex_init(&ha_info->ha_lock, NULL);
drivers/net/failsafe/failsafe.c: ret =
pthread_mutex_init(&priv->hotplug_mutex, &attr); drivers/net/hinic/base/hinic_compat.h: err = pthread_mutex_init(pthreadmutex, mattr);
drivers/raw/ifpga/base/opae_intel_max10.c: ret =
pthread_mutex_init(&dev->bmc_ops.lock, NULL); drivers/raw/ifpga/base/opae_spi_transaction.c: ret = pthread_mutex_init(&spi_tran_dev->lock, NULL);

lib/vhost/socket.c:     ret = pthread_mutex_init(&reconn_list.mutex, NULL);
lib/vhost/socket.c:     ret = pthread_mutex_init(&vsocket->conn_mutex, NULL);
Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.
#1 lore raw

https://bugs.dpdk.org/show_bug.cgi?id=1586

Thomas Monjalon ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Thomas Monjalon ([email protected]) --- Resolved in http://git.dpdk.org/dpdk/commit/?id=4d2aa15076

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.